import { formatNumber } from '@/utils/util'
import { TableColumnsType } from 'antd'
import dayjs from 'dayjs'
import type { DashBoardTimeAchieveVO } from './types'
const getNodeWithPercent = (info: string | null | undefined | number) => {
  if (info === null || info === undefined) return '-'
  const numericValue = typeof info === 'string' ? Number(info.trim()) : Number(info)
  if (Number.isNaN(numericValue)) return '-'
  return <span style={{ color: numericValue >= 100 ? '#3f8600' : '#cf1322' }}>{info + '%'}</span>
}
const getNodeWithNumber = (info: string | null | undefined | number) => {
  if (info === null || info === undefined) return '-'
  const numericValue = typeof info === 'string' ? Number(info.trim()) : Number(info)
  if (Number.isNaN(numericValue)) return '-'
  return <span style={{ color: numericValue <= 0 ? '#3f8600' : '#cf1322' }}>{info + '%'}</span>
}
const getCurrentQuarterSimple = (): 1 | 2 | 3 | 4 => {
  const month = dayjs().month() + 1 // 1-12
  if (month >= 3 && month <= 5) return 1
  if (month >= 6 && month <= 8) return 2
  if (month >= 9 && month <= 11) return 3
  return 4 // 12月,1月,2月
}
const moveElementAfterHead = (arr: any[], index: number): any[] => {
  // 处理边界情况
  if (arr.length <= 1 || index <= 0 || index >= arr.length) {
    return [...arr]
  }
  const head = arr[0]
  const rest = arr.slice(1)
  // 调整索引（因为去掉了第0项）
  const adjustedIndex = index - 1
  return [head, rest[adjustedIndex], ...rest.slice(0, adjustedIndex), ...rest.slice(adjustedIndex + 1)]
}
export const useOneColumns = (): TableColumnsType<DashBoardTimeAchieveVO> => {
  const data: TableColumnsType<DashBoardTimeAchieveVO> = [
    {
      title: '年度',
      align: 'center',
      children: [
        {
          title: '大类',
          dataIndex: 'bigClassName',
          key: 'bigClassName',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => info || '-',
        },
        {
          title: '返单量',
          dataIndex: 'returnOrderNum',
          key: 'returnOrderNum',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'targetDayNum',
          key: 'targetDayNum',
          align: 'center',
          fixed: 'left',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'actualDayNum',
          key: 'actualDayNum',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'achieveRate',
          key: 'achieveRate',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'historyAchieve',
          key: 'historyAchieve',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'yearOnYear',
          key: 'yearOnYear',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q1',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q1ReturnOrderNum',
          key: 'q1ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q1TargetDayNum',
          key: 'q1TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q1ActualDayNum',
          key: 'q1ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q1AchieveRate',
          key: 'q1AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q1HistoryAchieve',
          key: 'q1HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q1YearOnYear',
          key: 'q1YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q2',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q2ReturnOrderNum',
          key: 'q2ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q2TargetDayNum',
          key: 'q2TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q2ActualDayNum',
          key: 'q2ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q2AchieveRate',
          key: 'q2AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q2HistoryAchieve',
          key: 'q2HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q2YearOnYear',
          key: 'q2YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q3',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q3ReturnOrderNum',
          key: 'q3ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q3TargetDayNum',
          key: 'q3TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q3ActualDayNum',
          key: 'q3ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q3AchieveRate',
          key: 'q3AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q3HistoryAchieve',
          key: 'q3HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q3YearOnYear',
          key: 'q3YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q4',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q4ReturnOrderNum',
          key: 'q4ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q4TargetDayNum',
          key: 'q4TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q4ActualDayNum',
          key: 'q4ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q4AchieveRate',
          key: 'q4AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q4HistoryAchieve',
          key: 'q4HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q4YearOnYear',
          key: 'q4YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
  ]
  return moveElementAfterHead(data, getCurrentQuarterSimple())
}

export const useTwoColumns = (): TableColumnsType<DashBoardTimeAchieveVO> => {
  const data: TableColumnsType<DashBoardTimeAchieveVO> = [
    {
      title: '年度',
      align: 'center',
      children: [
        {
          title: '大类',
          dataIndex: 'bigClassName',
          key: 'bigClassName',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => info || '-',
        },
        {
          title: '返单量',
          dataIndex: 'returnOrderNum',
          key: 'returnOrderNum',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'targetDayNum',
          key: 'targetDayNum',
          align: 'center',
          fixed: 'left',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'actualDayNum',
          key: 'actualDayNum',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'achieveRate',
          key: 'achieveRate',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'historyAchieve',
          key: 'historyAchieve',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'yearOnYear',
          key: 'yearOnYear',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q1',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q1ReturnOrderNum',
          key: 'q1ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q1TargetDayNum',
          key: 'q1TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q1ActualDayNum',
          key: 'q1ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q1AchieveRate',
          key: 'q1AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q1HistoryAchieve',
          key: 'q1HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q1YearOnYear',
          key: 'q1YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q2',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q2ReturnOrderNum',
          key: 'q2ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q2TargetDayNum',
          key: 'q2TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q2ActualDayNum',
          key: 'q2ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q2AchieveRate',
          key: 'q2AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q2HistoryAchieve',
          key: 'q2HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q2YearOnYear',
          key: 'q2YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q3',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q3ReturnOrderNum',
          key: 'q3ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q3TargetDayNum',
          key: 'q3TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q3ActualDayNum',
          key: 'q3ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q3AchieveRate',
          key: 'q3AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q3HistoryAchieve',
          key: 'q3HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q3YearOnYear',
          key: 'q3YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q4',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q4ReturnOrderNum',
          key: 'q4ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q4TargetDayNum',
          key: 'q4TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q4ActualDayNum',
          key: 'q4ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q4AchieveRate',
          key: 'q4AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q4HistoryAchieve',
          key: 'q4HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q4YearOnYear',
          key: 'q4YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
  ]
  return moveElementAfterHead(data, getCurrentQuarterSimple())
}

export const useThreeColumns = (): TableColumnsType<DashBoardTimeAchieveVO> => {
  const data: TableColumnsType<DashBoardTimeAchieveVO> = [
    {
      title: '年度',
      align: 'center',
      children: [
        {
          title: '大类',
          dataIndex: 'bigClassName',
          key: 'bigClassName',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => info || '-',
        },
        {
          title: '返单量',
          dataIndex: 'returnOrderNum',
          key: 'returnOrderNum',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'targetDayNum',
          key: 'targetDayNum',
          align: 'center',
          fixed: 'left',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'actualDayNum',
          key: 'actualDayNum',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'achieveRate',
          key: 'achieveRate',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'historyAchieve',
          key: 'historyAchieve',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'yearOnYear',
          key: 'yearOnYear',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q1',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q1ReturnOrderNum',
          key: 'q1ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q1TargetDayNum',
          key: 'q1TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q1ActualDayNum',
          key: 'q1ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q1AchieveRate',
          key: 'q1AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q1HistoryAchieve',
          key: 'q1HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q1YearOnYear',
          key: 'q1YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q2',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q2ReturnOrderNum',
          key: 'q2ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q2TargetDayNum',
          key: 'q2TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q2ActualDayNum',
          key: 'q2ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q2AchieveRate',
          key: 'q2AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q2HistoryAchieve',
          key: 'q2HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q2YearOnYear',
          key: 'q2YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q3',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q3ReturnOrderNum',
          key: 'q3ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q3TargetDayNum',
          key: 'q3TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q3ActualDayNum',
          key: 'q3ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q3AchieveRate',
          key: 'q3AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q3HistoryAchieve',
          key: 'q3HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q3YearOnYear',
          key: 'q3YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q4',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q4ReturnOrderNum',
          key: 'q4ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q4TargetDayNum',
          key: 'q4TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q4ActualDayNum',
          key: 'q4ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q4AchieveRate',
          key: 'q4AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q4HistoryAchieve',
          key: 'q4HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q4YearOnYear',
          key: 'q4YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
  ]
  return moveElementAfterHead(data, getCurrentQuarterSimple())
}

export const useFourColumns = (): TableColumnsType<DashBoardTimeAchieveVO> => {
  const data: TableColumnsType<DashBoardTimeAchieveVO> = [
    {
      title: '年度',
      align: 'center',
      children: [
        {
          title: '大类',
          dataIndex: 'bigClassName',
          key: 'bigClassName',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => info || '-',
        },
        {
          title: '返单量',
          dataIndex: 'returnOrderNum',
          key: 'returnOrderNum',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'targetDayNum',
          key: 'targetDayNum',
          align: 'center',
          fixed: 'left',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'actualDayNum',
          key: 'actualDayNum',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'achieveRate',
          key: 'achieveRate',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'historyAchieve',
          key: 'historyAchieve',
          align: 'center',
          fixed: 'left',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'yearOnYear',
          key: 'yearOnYear',
          align: 'center',
          fixed: 'left',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q1',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q1ReturnOrderNum',
          key: 'q1ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q1TargetDayNum',
          key: 'q1TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q1ActualDayNum',
          key: 'q1ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q1AchieveRate',
          key: 'q1AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q1HistoryAchieve',
          key: 'q1HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q1YearOnYear',
          key: 'q1YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q2',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q2ReturnOrderNum',
          key: 'q2ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q2TargetDayNum',
          key: 'q2TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q2ActualDayNum',
          key: 'q2ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q2AchieveRate',
          key: 'q2AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q2HistoryAchieve',
          key: 'q2HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q2YearOnYear',
          key: 'q2YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q3',
      align: 'center',
      className: 'returntime_table_header_02',
      children: [
        {
          title: '返单量',
          dataIndex: 'q3ReturnOrderNum',
          key: 'q3ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q3TargetDayNum',
          key: 'q3TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q3ActualDayNum',
          key: 'q3ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q3AchieveRate',
          key: 'q3AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q3HistoryAchieve',
          key: 'q3HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q3YearOnYear',
          key: 'q3YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
    {
      title: 'Q4',
      align: 'center',
      className: 'returntime_table_header_01',
      children: [
        {
          title: '返单量',
          dataIndex: 'q4ReturnOrderNum',
          key: 'q4ReturnOrderNum',
          align: 'center',
          width: 80,
          render: (info) => {
            return formatNumber(info)
          },
        },
        {
          title: '目标天数',
          dataIndex: 'q4TargetDayNum',
          key: 'q4TargetDayNum',
          align: 'center',
          width: 100,
          render: (info) => <span style={{ color: 'var(--primary-color)' }}>{info || '-'}</span>,
        },
        {
          title: '实际达成天数',
          dataIndex: 'q4ActualDayNum',
          key: 'q4ActualDayNum',
          align: 'center',
          width: 90,
          render: (info) => <span style={{ fontWeight: 800 }}>{info || '-'}</span>,
        },
        {
          title: '达成率',
          dataIndex: 'q4AchieveRate',
          key: 'q4AchieveRate',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithPercent(info),
        },
        {
          title: '同期达成天数',
          dataIndex: 'q4HistoryAchieve',
          key: 'q4HistoryAchieve',
          align: 'center',
          width: 90,
          render: (info) => info || '-',
        },
        {
          title: '同比',
          dataIndex: 'q4YearOnYear',
          key: 'q4YearOnYear',
          align: 'center',
          width: 80,
          render: (info) => getNodeWithNumber(info),
        },
      ],
    },
  ]
  return moveElementAfterHead(data, getCurrentQuarterSimple())
}
